package aiku.numericalcontroloa.Controller;

import aiku.numericalcontroloa.Base.Utils.Result;
import aiku.numericalcontroloa.Model.Dto.ExportExcel.AttendanceExcelDto;
import aiku.numericalcontroloa.Model.Dto.OrderManagement.OrderDto;
import aiku.numericalcontroloa.Service.ExportExcelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 导出Excel控制层
 * @Author 黄广庭
 * @Date 2024/3/12 17:51
 */
@RestController
@RequestMapping("/exportExcel")
@Slf4j
public class ExportExcelCont {
    private final ExportExcelService exportExcelService;

    public ExportExcelCont(ExportExcelService exportExcelService) {
        this.exportExcelService = exportExcelService;
    }

    /**
     * 导出出勤记录（统计）
     * @return
     */
    @PostMapping("/attendanceStatistics")
    public Result attendanceStatistics(@RequestBody AttendanceExcelDto attendanceExcelDto){
        return exportExcelService.attendanceStatistics(attendanceExcelDto);
    }

    public Result generateContract(@RequestBody OrderDto orderDto){
        return exportExcelService.generateContract(orderDto);
    }
}
